﻿// ***********************************************************************
// Assembly         : SecurityLayer
// Author           : LJO+01 (Laurent Jordi)
// Created          : 06-05-2013
// Last Modified By : LJO+01 (Laurent Jordi)
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="_SecurityLayer_Base.cs" company="Copyright © Innovacall 2011">
//     Copyright (c) Copyright © Innovacall 2011. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;

namespace InnovaApp.Layers.SecurityLayer
{
    /// <summary>
    /// Class _SecurityLayer_Base
    /// </summary>
    public abstract class _SecurityLayer_Base
    {
        /// <summary>
        /// Enum enPasswordFormats
        /// </summary>
        public enum enPasswordFormats {
            /// <summary>
            /// The plain text
            /// </summary>
            PlainText = 0,
            /// <summary>
            /// The hashed
            /// </summary>
            Hashed = 1,
            /// <summary>
            /// The encrypted
            /// </summary>
            Encrypted = 2
        }

        /// <summary>
        /// Sets the application name with authority.
        /// </summary>
        public static void SetApplicationNameWithAuthority()
        {
            string toReturn = string.Empty;
            string authority = HttpContext.Current.Request.Url.Authority;
            string[] tAuthority = authority.Split(':')[0].Split('.');
            List<string> lAuthority = new List<string>(tAuthority);
            tAuthority = lAuthority.ToArray();
            Membership.ApplicationName = String.Join(".", tAuthority).ToLower();
            Roles.ApplicationName = Membership.ApplicationName;
        }
    }
}
